//index.js
//获取应用实例
const app = getApp()
import boyData from '../../mock/boyData.js'
import girlData from '../../mock/girlData.js'

Page({
  data: {
    flag: 0,
    bannerList: boyData.dataList,
    navigateList: boyData.navList,
    SwiperData: [
      [boyData.recomList.slice(0, 3)],
      [boyData.recomList.slice(3, 6)],
      [boyData.recomList.slice(6, 9)]
    ],
    bestSellerList: boyData.bestSellerList,
    everyWatchList: boyData.everyWatchList,
    modernRomanceList: girlData.modernRomanceList,
    completeCopyList: boyData.completeCopyList.slice(0, 3)
  },
  handleTab: function(e){
    let isGirl = e.currentTarget.dataset.flag * 1 === 0;
    this.setData({
      flag: e.currentTarget.dataset.flag * 1,
      bannerList: isGirl ? boyData.dataList : girlData.dataList,
      navigateList: isGirl ? boyData.navList : girlData.navList,
      recommendedList: isGirl ? [
        [boyData.recomList.slice(0, 3)],
        [boyData.recomList.slice(3, 6)],
        [boyData.recomList.slice(6, 9)]
      ] : [
        [girlData.recomList.slice(0, 3)],
        [girlData.recomList.slice(3, 6)],
        [girlData.recomList.slice(6, 9)]
      ],
      bestSellerList: isGirl ? boyData.bestSellerList : girlData.bestSellerList,
      everyWatchList: isGirl ? boyData.everyWatchList : girlData.everyWatchList,
      completeCopyList: isGirl ? boyData.completeCopyList.slice(0, 3) : girlData.completeCopyList
    })
  },
  onLoad: function () {

  },
  getUserInfo: function(e) {
    
  }
})
